<template>
	<el-pagination
		@size-change="handleSizeChange"
		@current-change="handleCurrentChange"
		:page-sizes="[1, 2, 5, 10]"
		:current-page="pagenum"
		:total="total"
		:page-size="pagesize"
		layout="total, sizes, prev, pager, next, jumper"
	>
	</el-pagination>
</template>
<script>
export default {
	name: 'Pagination',
	data() {
		return {
			userData: '',
			pagenum: 0,
			pagesize: 0,
			total: 0,
		}
	},
	methods: {
		handleSizeChange(val) {
			this.pagesize = val
			this.$bus.$emit('pagesize', this.pagesize)
		},
		handleCurrentChange(val) {
			this.pagenum = val
			this.$bus.$emit('pegenum', this.pagenum)
		},
	},
	created() {
		this.$bus.$on('pagination', data => {
			this.pagenum = data.pagenum
			this.pagesize = data.pagesize
		})
		this.$bus.$on('userList', data => {
			this.total = data.total
		})
	},
}
</script>
